package ckw.database;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;

public class Election extends core.modules.database.SuperElection implements
		Serializable {

	private static final long serialVersionUID = 1201476490205709562L;

	private Set<VotingCard> votingCards = new HashSet<VotingCard>();
	private Set<AdministratorToken> administratorTokens = new HashSet<AdministratorToken>();
	private Set<OKW_Election> okw_elections = new HashSet<OKW_Election>();
	private Set<VotersList> votersLists = new HashSet<VotersList>();
	private Set<NonresidentVoter> nonresidentVoters = new HashSet<NonresidentVoter>();

	public Election() {
		super();
	}

	public Election(String name, Timestamp startDate, Timestamp endDate) {
		super(name, startDate, endDate);
	}

	public Set<VotingCard> getVotingCards() {
		return votingCards;
	}

	public void setVotingCards(Set<VotingCard> votingCards) {
		this.votingCards = votingCards;
	}

	public void addToVotingCard(VotingCard votingCard){
		this.getVotingCards().add(votingCard);
		votingCard.setElection(this);
	}
	
	public void removeFromVotingCard(VotingCard votingCard) {
		this.getVotingCards().remove(votingCard);
		votingCard.setElection(null);
	}

	public Set<AdministratorToken> getAdministratorTokens() {
		return administratorTokens;
	}

	public void setAdministratorTokens(
			Set<AdministratorToken> administratorTokens) {
		this.administratorTokens = administratorTokens;
	}

	public Set<OKW_Election> getOkw_elections() {
		return okw_elections;
	}

	public void setOkw_elections(Set<OKW_Election> okw_elections) {
		this.okw_elections = okw_elections;
	}
	
	public Set<VotersList> getVotersLists() {
		return votersLists;
	}

	public void setVotersLists(Set<VotersList> votersLists) {
		this.votersLists = votersLists;
	}

	public void addToVotersList(VotersList votersList) {
		this.getVotersLists().add(votersList);
		votersList.getElections().add(this);
	}

	public void removeFromVotersList(VotersList votersList) {
		this.getVotersLists().remove(votersList);
		votersList.getElections().remove(this);
	}

	public Set<NonresidentVoter> getNonresidentVoters() {
		return nonresidentVoters;
	}

	public void setNonresidentVoters(Set<NonresidentVoter> nonresidentVoters) {
		this.nonresidentVoters = nonresidentVoters;
	}
}
